import java.util.Scanner;

public class MC0420地势复杂度 {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        // code here
        int n = input.nextInt();
        int m = input.nextInt();
        // f 数组用于存储前缀和，大小为 n+1, m+1 以方便处理边界
        long[][] f = new long[n+1][m + 1];
        //// 计算二维前缀和
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                long cur = f[i][j] = input.nextInt();
                //前缀和公式
                f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1] + cur;
            }
        }
        //查表f ,并计算 g(i,j)
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                //g[1][1] = f[1][1] / (1*1) = 1 / 1 = 1
                long ans = f[i][j] /((long) i * j);
                System.out.print(ans + " ");
            }
            System.out.println();
        }
        input.close();
    }
}
